{% extends "base.html" %}

{% block head %}
    {{ super() }}
    <script type="text/javascript" src="{{ request.script_root }}{{ MEDIA_URL }}markit/jquery.markitup.js"></script>
    <script type="text/javascript" src="{{ request.script_root }}{{ MEDIA_URL }}markit/sets/rest/set.js"></script>

    <link rel="stylesheet" type="text/css" href="{{ request.script_root }}{{ MEDIA_URL }}markit/skins/simple/style.css" />
    <link rel="stylesheet" type="text/css" href="{{ request.script_root }}{{ MEDIA_URL }}markit/sets/rest/style.css" />

    <script type="text/javascript" src="{{ request.script_root }}{{ MEDIA_URL }}scripts/editor.js"></script>

<script type="text/javascript">
    var js_params = {{ js_params|tojson|safe }};
	$(function() {
	    if (js_params.theme) {
	        $('.themes input[value='+ js_params.theme + ']')[0].checked = true;
	    }

	    if (location.hash) {
	        $('#editor').val(getDecodedHash());
	    }
	});

</script>

{% endblock %}


{% block editor_nav %}
<ul>
    <li><a href="#" id="as_pdf" class="jslink">Export to PDF</a></li>
</ul>
{% endblock %}

{% block content %}
<div class="b_page_cont">
    <div class="b_page_left">
        <textarea id="editor" rows="15">{{ rst }}</textarea>
    </div>
    <div class="b_page_right">
        <div class="right_nav">
            <div class="themes left" id="themes">Theme:
                <input id="t_basic" type="radio" value="basic" checked="checked" name="style"/><label for="t_basic">Basic</label>
                <input id="t_nature" type="radio" value="nature" name="style"/><label for="t_nature">Nature</label>
            </div>
        </div>
	    <iframe src="{{ request.script_root }}/srv/rst2html/" id="browse"></iframe>
    </div>
</div>

</div>

<form id="save_as_pdf" method="POST" action="{{ request.script_root }}/srv/rst2pdf/">
    <input type="hidden" id="as_pdf_rst" name="rst" />
    <input type="hidden" id="as_pdf_theme" name="theme"/>
</form>

{% endblock %}
